//
//  UIView+Extension.swift
//  Weibo-swift
//
//  Created by GD on 16/9/19.
//  Copyright © 2016年 geduo. All rights reserved.
//     分类里面不能添加存储属性.  只能扩展计算属性

import UIKit

extension UIView{

    //扩展计算属性
    var x : CGFloat {
        get {
            return frame.origin.x
        }set {
            frame.origin.x = newValue
        }
    }
    
    var y : CGFloat {
        get {
            return frame.origin.y
        }set {
            frame.origin.y = newValue
        }
    }
    
    //w   h
    var width : CGFloat {
        get {
            return frame.size.width
        }set {
            frame.size.width = newValue
        }
    }
    
    var height : CGFloat {
        get {
            return frame.size.height
        }set {
            frame.size.height = newValue
        }
    }
    
    //center
    var centerX : CGFloat {
        get {
            return center.x
        }set {
            center.x = newValue
        }
    }
    
    var centerY : CGFloat {
        get {
            return center.y
        }set {
            center.y = newValue
        }
    }
    
    // size
    var size : CGSize {
        get{
            return frame.size
        }set{
            frame.size = newValue
        }
    
    }
    
    


}
